import React, { Component } from "react";
import { ResumeContenxt } from "./_store";

class View extends Component {
  // static contextType = ResumeContenxt;
  componentDidMount() {
    setTimeout(() => {
      this.getTest();
    }, 2000);
  }
  getTest() {
    const { genders, callback } = this.context;
    callback(111);
  }
  render() {
    console.log(this.context);
    const { base, left, com } = this.context;
    return (
      <div>
        这是contextChild2----{base.genders}
        <br />
        {left()}
        {com()}
        <ResumeContenxt.Consumer>
          {(value) => <div>{value.base.genders}</div>}
        </ResumeContenxt.Consumer>
      </div>
    );
  }
}
// 第三种
View.contextType = ResumeContenxt;
export default View;
